<div class="users form">
{{if $current_action=='admin_add'}}
<?php
echo $this->MForm->create($current_model,array(    
	'url' => array('action' => 'add'),
));
?>
{{elseif $current_action=='admin_edit'}}
<?php 
echo $this->MForm->create($current_model,array(
    'url' => array('action' => 'edit',$id,$copy),
));
?>

{{/if}}
    
<fieldset>
{{if $copy}}
<div class="alert alert-warning">
复制数据，保存时，创建一条新的数据记录。修改不影响原记录内容。
</div>
{{/if}}


<p><a target="_blank" href="/admin/{{$current_controller}}/list"><i class="fa fa-angle-double-left"></i> &nbsp; 返回数据列表</a></p>
<hr>

	<ul class="nav nav-tabs">
	    <li class="active"><a href="#basic-info" data-toggle="tab"><span>{{__('Basic')}}</span></a></li>
	    <li><a href="#category-advanced" data-toggle="tab"><span>{{__('Advanced Options')}}</span></a></li>
	    <li><a href="#category-seo" data-toggle="tab"><span>{{__('SEO')}}</span></a></li>
	    <li><a href="#category-content" data-toggle="tab"><span>{{__('Content')}}</span></a></li>
	    
	    {{$this->Layout->getLanguageTabHead($current_model)}}
	</ul>
	<div class="tab-content">
		<div id="basic-info"  class="tab-pane active" >
	    
	    <?php
if($current_action=='admin_add' || !$copy) {
	echo $this->MForm->input('id');        
}
echo $this->MForm->input('parent_id');
echo $this->MForm->input('name',array('required'=>'required',));
echo $this->MForm->input('slug',array('required'=>'required',));
echo $this->MForm->input('visible',array('type'=>'select','default'=>1)); 
echo $this->MForm->input('link');
echo $this->MForm->swfupload('coverimg',array('modelClass'=>'Category','after'=>'栏目为站点时，封面图片当成站点logo'));

echo $this->MForm->swfupload('banner',array('no_thumb'=>1));

echo $this->MForm->input('prefix_icon');
echo $this->MForm->input('model');
echo $this->MForm->input('columns');
    ?>
    	<div class="form-group success">
	    	<label class="col-sm-2 control-label" for="CategoryTemplate">内容列表样式</label>
	    	<div class="col-sm-10 controls select">
	    		<?php 
	    		echo $this->MForm->input('template_choose',array('label'=>false,'div'=>false,
	    			'type'=>'select','value'=>$this->MForm->data['Category']['template'],
	    			'options'=> array(
	    				'categories/_list' => '标题摘要',
	    				'categories/_titlelist'=>'标题',
	    				'categories/_singlecontent'=>'内容',
	    				'categories/_photolist'=>'标题图片（固定宽高）',
	    				'categories/_masonry_photo'=>'图片墙（定宽变高）',
	    				''=>'其他',
	    			),
	    		));
				echo $this->MForm->input('template',array('label'=>false,'default'=>'categories/_list','div'=>false,'style'=>'display:none;','type'=>'text'));
			?>
			</div>
		</div>
	    </div>
	    <div id="category-advanced" class="tab-pane">
	    	<?php
	    	
		echo $this->MForm->input('domain');
		echo $this->MForm->input('is_index');
		echo $this->MForm->input('theme'); 
		echo $this->MForm->input('view_template'); 
		echo $this->MForm->input('view_layout'); 
		?>
		
		{{$this->MForm->input('model_conditions',array('rows'=>3,'cols'=>100))}}
		

	    	{{$this->MForm->input('submenu',array('rows'=>3,'cols'=>100))}}
	    	{{$this->MForm->input('extra_script',array('rows'=>5,'cols'=>100))}}
	    </div>
	    
	    <div id="category-seo" class="tab-pane">
		    {{$this->MForm->input('seotitle')}}
		    {{$this->MForm->input('seokeywords',array('rows'=>3,'cols'=>100))}}
		    {{$this->MForm->input('seodescription',array('rows'=>3,'cols'=>100))}}
	    </div>
	    <div id="category-content" class="tab-pane">
		    {{$this->MForm->input('description')}}
		    {{$this->MForm->editor135('content',array('label' => false,'is_admin'=>true,'div'=>'wygiswys'))}}
	    </div>  
	    {{$this->Layout->getLanguageTabContent($current_model)}}
	    
	</div>
	<div class="form-group">
    	<label class="col-sm-2 control-label"></label>
    	<div class="col-sm-10 controls"><?php echo $this->MForm->submit(__('Submit'),array('id'=>'btnsubmit')); ?></div>
    </div>
    </fieldset>
	{{$this->MForm->end()}}
</div>
<script>
$(function(){
	
	var template = $('#CategoryTemplate').val();
	if(template == ""){
		$('#CategoryTemplateChoose').trigger('change');
	}
	else{
		$('#CategoryTemplate').show();
		$('#CategoryTemplateChoose').val('');
	}
	$('#CategoryTemplateChoose').change(function(){
		if(this.value==""){
			$('#CategoryTemplate').show();
		}
		else{
			$('#CategoryTemplate').hide().val(this.value);
		}
	}).trigger('change');
});

/**
 * 模型改变时，设置link的默认值
 */
function selectModel(){
	if(this.value!=""){
		$('#CategoryLink').value = '/controller:{model}/{slug}';
	}
	else{
		$('#CategoryLink').value = '';
	}
}
</script>